x86: Avoid calling xsave_alloc_save_area before xsave_init
authorKeir Fraser <keir@xen.org>
Fri, 14 Jan 2011 08:34:53 +0000 (08:34 +0000)
committerKeir Fraser <keir@xen.org>
Fri, 14 Jan 2011 08:34:53 +0000 (08:34 +0000)
commit5a96732bd4101281bc1c609a08688cc87de61b26
tree69738083a4658df044494c7fef153ca0d1cf9a90
parent91fa20635ad51008527345579467687a2ccb168e
x86: Avoid calling xsave_alloc_save_area before xsave_init

Currently, xsave_alloc_save_area will be called in
init_idle_domain->scheduler_init->alloc_vcpu->vcpu_initialise calls
with xsave_cntxt_size=0, it is earlier than xsave_init called in
identity_cpu(). This may causing buffer overflow on xmem_pool.

Idle domain isn't using FPU,SSE,AVX or any such extended state and
doesn't need it saved. xsave_{alloc,free}_save_area() should
test-and-exit on is_idle_vcpu(), and our context switch code should
not be doing XSAVE when switching out an idle vcpu.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen/arch/x86/i387.c
xen/include/asm-x86/i387.h